package com.mygdx.canyonbunny.util;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class AssetLoader {

	public static Texture texture;
	public static Animation horseAnimation;
	public static TextureRegion horse1, horse2;
	public static Sound jump;

	public static void load() {
		texture = new Texture(Gdx.files.internal("texture-horse.png"));
		texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);

		horse1 = new TextureRegion(texture, 0, 0, 39, 24);
		horse1.flip(false, true);
		horse2 = new TextureRegion(texture, 39, 0, 39, 24);
		horse2.flip(false, true);
		TextureRegion[] horses = { horse1, horse2 };
		horseAnimation = new Animation(0.1f, horses);
		horseAnimation.setPlayMode(Animation.PlayMode.LOOP_PINGPONG);
		jump = Gdx.audio.newSound(Gdx.files.internal("jump.wav"));

	}

	public static void dispose() {
		// We must dispose of the texture when we are finished.
		texture.dispose();
		jump.dispose();
	}
}
